import Buff from '@/Buff';
import BuffUtil from '@/BuffUtil';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 极速攻击
 **/
export default class BossSpell_FastAttack extends AbilityBase {
    static instance: BossSpell_FastAttack;
    buffType: AppBuffType = {
        id: 'buff_BossSpell_FastAttack',
        art: this.art,
        name: this.abilityName,
        ubertip: this.ubertip,
        attribute: {
            attackSpd_p: 99,
            damage_cool: -0.75,
        },
        targetAttach: 'weapon',
        targetArt: 'Abilities\\Spells\\Orc\\Bloodlust\\BloodlustSpecial.mdl',
        onCreated: this.buffCreated.bind(this),
        onDestroy: this.buffDestroy.bind(this),
        dur: 7,
    };
    buffCreated(buff: Buff) {
        buff.leftEffect = AddSpecialEffectTarget('Abilities\\Spells\\Orc\\Bloodlust\\BloodlustTarget.mdl', buff.getParent(), 'left hand');
        buff.rightEffect = AddSpecialEffectTarget('Abilities\\Spells\\Orc\\Bloodlust\\BloodlustTarget.mdl', buff.getParent(), 'right hand');
    }
    buffDestroy(buff: Buff) {
        DestroyEffect(buff.leftEffect);
        DestroyEffect(buff.rightEffect);
    }
    constructor(id: string = 'Mxg0') {
        super(id);
        BossSpell_FastAttack.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        BossAbilityManagerInstance.text('极速攻击', source);
        BuffUtil.addBuff(source, this.buffType.id, source);
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
